package com.artron.mediaartron.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.artron.mediaartron.base.BaseFragmentPagerAdapter;
import com.artron.mediaartron.data.entity.SameSizeFrame;
import com.artron.mediaartron.ui.fragment.factory.CustomSelectionVerticalFragmentFactory;
import com.artron.mediaartron.ui.fragment.made.CustomSelectionVerticalFragment;

import java.util.List;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-09-21.
 */

public class SelectionVerticalPagerAdapter extends BaseFragmentPagerAdapter {

    private final List<SameSizeFrame> mData;
    private final CustomSelectionVerticalFragmentFactory mFactory;

    public SelectionVerticalPagerAdapter(FragmentManager fm, List<SameSizeFrame> data) {
        super(fm);
        mData = data;
        mFactory = CustomSelectionVerticalFragmentFactory.getInstance(getCount());
    }

    @Override
    public Fragment getItem(int position) {
        CustomSelectionVerticalFragment fragment = mFactory.getFragment(position);
        fragment.init(mData.get(position));
        return fragment;
    }

    @Override
    public int getCount() {
        return mData.size();
    }


}
